package com.jk.dmconsumer.controller;

import com.jk.dmcommon.entity.TicketEntity;
import com.jk.dmcommon.entity.YeWuEntity;
import com.jk.dmconsumer.service.ShopService;
import jdk.nashorn.internal.runtime.SharedPropertyMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


import java.util.List;

/**
 * @author 赵优秀
 * @version 1.0.0
 * @ClassName ShopController.java
 * @Description TODO
 * @createTime 2021年09月09日 16:41:00
 */
@Controller
@RequestMapping("lgf")
public class ShopController {
    @Autowired
    private ShopService shopService;

    /**
     * @title 查询活动之类的
     * @description
     * @author 刘卧龙
     * @updateTime 2021/9/10 10:45
     * @throws
     */
    @RequestMapping("findShop")
    @ResponseBody
    public Object findShop(Integer goodsId){
        System.out.println("11111111111111"+goodsId);
        return shopService.findShop(goodsId);
    }
    /**
     * @title 查询优惠券活动
     * @description
     * @author 赵优秀
     * @updateTime 2021/9/10 10:45
     * @throws
     */

    @RequestMapping("getCoupon")
    @ResponseBody
    public List<TicketEntity> getCoupon(){

        return shopService.getCoupon();
    }
    /**
     * @title 给支付页面传值
     * @description
     * @author 赵优秀
     * @updateTime 2021/9/10 19:23
     * @throws
     */
    @RequestMapping("buy")
    public String buy(Model model,YeWuEntity yeWuEntity){
            YeWuEntity   yu=   shopService.buy(yeWuEntity);
        model.addAttribute("order",yeWuEntity);

        //return "zhanshiqiantai/search.damai.cn/xuanzuo";
        return "sitePageWl";
    }

    /**
     * @description:  选座位页面，给郭英杰传值
     * @param: [model, yeWuEntity]
     * @return: java.lang.String
     * @author 刘杨彬
     * @date: 2021/9/14 19:48
     */
    @RequestMapping("affirmBuy")
    public String affirmBuy(Model model,YeWuEntity yeWuEntity){
        YeWuEntity   yu=   shopService.affirmBuy(yeWuEntity);
        model.addAttribute("order",yeWuEntity);
        return "paymentOrder";
    }



/*
    @RequestMapping("zuowei")
    @ResponseBody
    public void zuowei(String site){
        shopService.zuowei(site);
    }
*/  
    /**
    *  @方法描述 (生成座位)
     * @Author 王乐
     * @Description //TODO 
     * @Date  2021/9/20 9:51
     * @Param [id]
     * @return java.lang.String
     **/
    @RequestMapping("createSite")
    @ResponseBody
    public String createSite(Integer id){
        String str = shopService.createSite(id);
        return str;
    }
    /**
    *  @方法描述 (提交选座)
     * @Author 王乐
     * @Description //TODO 
     * @Date  2021/9/20 17:27
     * @Param [siteArr]
     * @return java.lang.String
     **/
    @RequestMapping("subSite")
    @ResponseBody
    public String subSite(String siteArr,Integer id){
        return shopService.subSite(siteArr,id);
    }







}
